/**********************************************************************************************/
/* FBL_OsWin.h 		                                                      					  */
/*                                                                       					  */
/* Copyright Paradigma, 1993-2006															  */
/* All Rights Reserved                                                   					  */
/**********************************************************************************************/

#ifndef _FBL_OsWin_h 
	#define _FBL_OsWin_h
#pragma once

#define WIN32_LEAN_AND_MEAN		/* Exclude rarely-used stuff from Windows headers */
#define NOMINMAX          
#include <windows.h>

//#include <winsock2.h>


/**********************************************************************************************/
FBL_Begin_Namespace


/**********************************************************************************************/
// If your platform does not have the <inttypes.h> header, you may
// need to edit the typedefs below.

typedef signed char int8_t;
typedef unsigned char uint8_t;
typedef signed short int16_t;
typedef unsigned short uint16_t;

#if defined(_LP64)
typedef signed long int32_t;
#else
typedef signed int  int32_t;
#endif

#if defined(_LP64)
typedef unsigned long uint32_t;
#else
typedef unsigned int  uint32_t;
#endif

#if defined(__MWERKS__)	// CodeWarrior C/C++ from Metrowerks, Inc.
typedef long long   int64_t;
#else 
// Assume that MSVC is used
typedef signed __int64   int64_t;
#endif // __MWERKS__

#if defined(__MWERKS__)	// CodeWarrior C/C++ from Metrowerks, Inc.
typedef unsigned long long uint64_t;
#else
// Assume that MSVC is used
typedef unsigned __int64   uint64_t;
#endif // __MWERKS__


/**********************************************************************************************/
// GLOBAL FUNCTIONS:
//
inline ulong TickCount( void )
{
	return ::GetTickCount() / 16;
}


/**********************************************************************************************/
typedef uchar* StringPtr;
typedef const uchar* ConstStringPtr;
typedef uchar Str255[256];
typedef ulong OSType;

// Common system-independent and compiler-independent macro FBL_CHECK(x) 
#ifndef __CHECK
	#define __CHECK 0
#endif

#if __CHECK == 0
	#define CHECK(p) (void(0))
#else
		#ifdef _MSC_VER
			#if DEBUG_NEW == 0
				#include <crtdbg.h>
			#endif
			#define CHECK(p)  { /*_ASSERTE(p);*/ \
				gTotalAssertCount++;\
					if(!(p)) LogAssert(__FILE__,__FUNCTION__,__LINE__,#p); }	
		#else
			#define CHECK(p)  { gTotalAssertCount++;\
				if(!(p)) LogAssert(__FILE__,__FUNCTION__,__LINE__,#p); }
		#endif
#endif


/**********************************************************************************************/
FBL_End_Namespace


/**********************************************************************************************/
#endif // _FBL_OsWin_h
